<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>优铺Admin</title>

<!-- Bootstrap -->
<link href="/vendors/bootstrap/dist/css/bootstrap.min.css"
	rel="stylesheet">
<!-- Font Awesome -->
<link href="/vendors/font-awesome/css/font-awesome.min.css"
	rel="stylesheet">
<!-- NProgress -->
<link href="/vendors/nprogress/nprogress.css" rel="stylesheet">
<!-- Animate.css -->
<link href="/vendors/animate.css/animate.min.css" rel="stylesheet">

<!-- Custom Theme Style -->
<link href="/build/css/custom.min.css" rel="stylesheet">

<script src="/vendors/jquery/dist/jquery.min.js"></script>
</head>

<body class="login">
	<div>
		<a class="hiddenanchor" id="signup"></a> <a class="hiddenanchor" id="signin"></a>

		<div class="login_wrapper">
			<div class="animate form login_form">
				<section class="login_content">
					<form>
						<h1>Login Form</h1>
						<div>
							<input type="text" class="form-control" id="username" placeholder="Username" required="required" />
						</div>
						<div>
							<input type="password" class="form-control" id="password" placeholder="Password" required="required" />
						</div>
						<div>
							<a class="btn btn-default submit" href="javascript:;" onClick="login()">Log in</a>
							<a class="reset_pass" href="#">Lost your password?</a>
						</div>

						<div class="clearfix"></div>

						<div class="separator">

							<div class="clearfix"></div>
							<br />

							<div>
								<h1>
									<i class="fa fa-paw"></i> 优铺Admin
								</h1>
								<p>©2016 All Rights Reserved. YouPu Team</p>
							</div>
						</div>
					</form>
				</section>
			</div>
		</div>
	</div>
<script src="/dic/sha256.js"></script>
<script type="text/javascript">
function login(){//传入表单参数
	var account = $("#username").val();
	var passwordX = $("#password").val();
    if(account==""){       //验证用户名是否为空
        alert("请输入用户名！");
        $("#username").focus();
    		return false;
    }
    if(passwordX==""){       //验证密码是否为空
        alert("请输入密码！");
        $("#password").focus();
    		return false;
    }
    password = sha256_digest(passwordX);
    var param="/dologin";
    $.ajax({
        url:param,
        type:"POST",
        dataType:"json",
        data: {"account":account,"password":password},
        success:function(data){
            if(data.status == 200){
                window.location.href = "index.html";//跳转到主页

            }else{
               alert(data.msg);
            }
        }
    });
}
</script>
</body>
</html>
